package com.xtayfjpk.security;

import java.math.BigInteger;
import java.security.AlgorithmParameterGenerator;
import java.security.AlgorithmParameters;
import java.security.Security;

import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.junit.Test;

public class AlgorithmParameterTest {
	
	@Test
	public void testAlgorithmParameterGenerator() throws Exception {
		Security.addProvider(new BouncyCastleProvider());
		
		AlgorithmParameterGenerator generator = AlgorithmParameterGenerator.getInstance("DES");
		generator.init(56);
		AlgorithmParameters ap = generator.generateParameters();
		byte[] bytes = ap.getEncoded();
		System.out.println(new BigInteger(bytes));
	}
	
	@Test
	public void testAlgorithmParameters() throws Exception {
		Security.addProvider(new BouncyCastleProvider());
		
		AlgorithmParameters ap = AlgorithmParameters.getInstance("DES");
		ap.init(new BigInteger("19041263384671890964439").toByteArray());
		System.out.println(new BigInteger(ap.getEncoded()));
	}
}
